<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子17-JS进阶（三）</title>
    </head>
    <body>
        <pre>
            <code>
                    // 例子17

                    var str = 'abcdef';
                    var pattern = /ab|cd|ef/; // 可以匹配ab或cd或ef
                    str.match(pattern); // [ab], 从左到右先匹配到ab，后面的匹配忽略
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/17.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>